package homework;

import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-11-27
 * Time: 15:35
 */
public class H230802 {
    public static void main(String[] args) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5,
                10,
                60,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(100),
                new ThreadPoolExecutor.DiscardPolicy());
    }
    public static void main1(String[] args) {
        AtomicInteger integer = new AtomicInteger();
        Thread thread = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                integer.getAndIncrement();
            }
        });
        Thread thread1 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                integer.getAndIncrement();
            }
        });
        thread.start();
        thread1.start();
        try {
            thread.join();
            thread1.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(integer);
    }
}
